<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="objectId" id="objectId" value="">
            <input type="hidden" name="type" id="type" value="32">
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        申请人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="1815">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        需求审批表编号：
                    </td>
                    <td colspan="3">
                        <input type="text" name="purchaseCode" id="purchaseCode" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <span style="margin-left:2px;" id="toView"><a
                                href="javascript:viewPurchase(10351);">查看详情</a></span>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        费用承担部门：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyDeptName" id="applyDeptName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        审批人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="approvalNames" id="approvalNames"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总金额：
                    </td>
                    <td colspan="3">
                        <input type="text" id="cost" class="easyui-numberbox numberbox-f validatebox-text" precision="2"
                            numberboxname="cost"><input type="hidden" name="cost" value="3451.16">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        供应商说明：
                    </td>
                    <td colspan="3">
                        <textarea name="supplierContent" id="supplierContent" style="width:732px;height:100px"
                            readonly="readonly"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        采购内容：
                    </td>
                    <td colspan="3">
                        <div style="margin-left:10px;">
                            <div id="showFiles">
                                <div style="margin-top:8px;margin-bottom:8px;">优启计划对账单2025年8-9月.pdf<a
                                        style="margin-left:10px" href="javascript:" onclick="downfile(784839)">下载</a>
                                    <div style="margin-top:8px;margin-bottom:8px;">优启计划结算单-2025年8-9月.docx<a
                                            style="margin-left:10px" href="javascript:"
                                            onclick="downfile(784838)">下载</a></div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr class="is_signtr">
                    <td class="tdc1">
                        是否签订合同：
                    </td>
                    <td colspan="3">
                        <input name="is_sign" id="is_sign">
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        我方单位名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="myCompanyName" id="myCompanyName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        签约单位名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="companyName" id="companyName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        合同名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="contractName" id="contractName"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        合同金额<span style="color: red">(此价格为含税)</span>：
                    </td>
                    <td style="width:36%">
                        <input type="text" id="money" class="easyui-numberbox numberbox-f validatebox-text"
                            precision="2" numberboxname="money"><input type="hidden" name="money" value="3451.16">
                    </td>
                    <td class="tdc1" style="width:160px;">
                        合同类型：
                    </td>
                    <td>
                        <input name="contractType" id="contractType">
                    </td>
                </tr>
                <tr id="othertr" style="display:none">
                    <td class="tdc1">
                        其他：
                    </td>
                    <td colspan="3">
                        <input type="text" name="otherthing" id="otherthing"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        合同内容：
                    </td>
                    <td colspan="3">
                        <textarea name="content" id="content" style="width:70%;height:60px"></textarea>
                    </td>
                </tr>
                <tr class="hidetr" style="">
                    <td class="tdc1">
                        相关附件：
                    </td>
                    <td>
                        <div style="margin-left:10px;">
                            <div id="showFiles1">
                                <div style="margin-top:8px;margin-bottom:8px;">Ucloud专属云服务合同.pdf<a
                                        style="margin-left:10px" href="javascript:" onclick="downfile(784840)">下载</a>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>

    <br>
    <div id="tools" class="datagrid-toolbar">
    </div>
    <div id="search" class="datagrid-toolbar" style="display:none;">
        <input type="hidden" name="bid" id="bid" value="9219">
    </div>

    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 739px; height: auto;">
            <div class="datagrid-view" style="width: 739px; height: 50px;">
                <style type="text/css">
                    div.datagrid-cell-c1-content {
                        width: 192px;
                    }

                    div.datagrid-cell-c1-counts {
                        width: 142px;
                    }

                    div.datagrid-cell-c1-price {
                        width: 292px;
                    }

                    div.datagrid-cell-c1-remark {
                        width: 292px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 25px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr id="datagrid-row-r1-1-0" datagrid-row-index="0" class="datagrid-row"
                                        style="height: 25px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">1</div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 698px;">
                    <div class="datagrid-header" style="width: 698px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="content">
                                            <div class="datagrid-cell" style="width: 128px;"><span>名称、型号、配置</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="counts">
                                            <div class="datagrid-cell" style="width: 94px;"><span>数量</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="price">
                                            <div class="datagrid-cell" style="width: 196px;"><span>单价</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="remark">
                                            <div class="datagrid-cell" style="width: 199px;"><span>备注</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 698px; height: 25px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                            <tbody>
                                <tr id="datagrid-row-r1-2-0" datagrid-row-index="0" class="datagrid-row"
                                    style="height: 25px;">
                                    <td field="id">
                                        <div style="" class="datagrid-cell-check "><input type="checkbox" name="id"
                                                value="20926"></div>
                                    </td>
                                    <td field="content">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c1-content">8-9月平台云服务结算</div>
                                    </td>
                                    <td field="counts">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c1-counts">1</div>
                                    </td>
                                    <td field="price">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c1-price">3451.16</div>
                                    </td>
                                    <td field="remark">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c1-remark"></div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 698px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示1到1,共1记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>

    <br>
    <div id="tools" class="datagrid-toolbar">
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 724px; height: auto;">
            <div class="datagrid-view" style="width: 724px; height: 136px;">
                <style type="text/css">
                    div.datagrid-cell-c2-supplierName {
                        width: 192px;
                    }

                    div.datagrid-cell-c2-orprice {
                        width: 142px;
                    }

                    div.datagrid-cell-c2-contactWay {
                        width: 292px;
                    }

                    div.datagrid-cell-c2-remark {
                        width: 292px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 111px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr id="datagrid-row-r2-1-0" datagrid-row-index="0" class="datagrid-row"
                                        style="height: 37px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">1</div>
                                        </td>
                                    </tr>
                                    <tr id="datagrid-row-r2-1-1" datagrid-row-index="1" class="datagrid-row"
                                        style="height: 37px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">2</div>
                                        </td>
                                    </tr>
                                    <tr id="datagrid-row-r2-1-2" datagrid-row-index="2" class="datagrid-row"
                                        style="height: 37px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">3</div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 683px;">
                    <div class="datagrid-header" style="width: 683px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="supplierName">
                                            <div class="datagrid-cell" style="width: 125px;"><span>供应商名称</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="orprice">
                                            <div class="datagrid-cell" style="width: 92px;"><span>报价</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="contactWay">
                                            <div class="datagrid-cell" style="width: 192px;"><span>联系人、联系方式</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="remark">
                                            <div class="datagrid-cell" style="width: 193px;"><span>备注</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 683px; height: 111px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0">
                            <tbody>
                                <tr id="datagrid-row-r2-2-0" datagrid-row-index="0" class="datagrid-row"
                                    style="height: 37px;">
                                    <td field="id">
                                        <div style="" class="datagrid-cell-check "><input type="checkbox" name="id"
                                                value="17341"></div>
                                    </td>
                                    <td field="supplierName">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-supplierName">杭州博思芯宇科技有限公司</div>
                                    </td>
                                    <td field="orprice">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-orprice">4000</div>
                                    </td>
                                    <td field="contactWay">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-contactWay">李晨，13552751662</div>
                                    </td>
                                    <td field="remark">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-remark"></div>
                                    </td>
                                </tr>
                                <tr id="datagrid-row-r2-2-1" datagrid-row-index="1" class="datagrid-row"
                                    style="height: 37px;">
                                    <td field="id">
                                        <div style="" class="datagrid-cell-check "><input type="checkbox" name="id"
                                                value="17340"></div>
                                    </td>
                                    <td field="supplierName">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-supplierName">北京并行科技股份有限公司</div>
                                    </td>
                                    <td field="orprice">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-orprice">4000</div>
                                    </td>
                                    <td field="contactWay">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-contactWay">吴文杰 18621949062</div>
                                    </td>
                                    <td field="remark">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-remark"></div>
                                    </td>
                                </tr>
                                <tr id="datagrid-row-r2-2-2" datagrid-row-index="2" class="datagrid-row"
                                    style="height: 37px;">
                                    <td field="id">
                                        <div style="" class="datagrid-cell-check "><input type="checkbox" name="id"
                                                value="17339"></div>
                                    </td>
                                    <td field="supplierName">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-supplierName">优刻得科技股份有限公司</div>
                                    </td>
                                    <td field="orprice">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-orprice">3451.16</div>
                                    </td>
                                    <td field="contactWay">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-contactWay">韩祾儿 13611950756</div>
                                    </td>
                                    <td field="remark">
                                        <div style="white-space:normal;height:auto;"
                                            class="datagrid-cell datagrid-cell-c2-remark"></div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 683px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data2" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示1到3,共3记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div>
    <br>
    <br>
    <div style="margin-left:10px;">
        <div id="showRecords">
            <div style="margin-top:8px;margin-bottom:8px;">审核人：徐艳艳<span style="margin-left:15px;">尚未审核</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：韩威<span style="margin-left:15px;">尚未审核</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：王维<span style="margin-left:15px;">审核时间：2025-11-04
                    09:20:08</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">复核人：王博宇<span style="margin-left:15px;">尚未复核</span></div>
        </div>
    </div>




    <script>


        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");

        var objectId = new Date().getTime();
        var process_id = $.getUrlParam("processid");
        if (process_id != null) {
            $.ajax({
                type: "GET",
                url: contextPath + "manager/approvalprocess/getBeanIdByProcessId/" + process_id + "/" + type,
                data: null,
                dataType: "json",
                success: function (data) {
                    if (data && data.handleMsg.status == 1) {
                        p_id = data.id;
                        if (p_id != null) {
                            objectId = p_id;
                            $("#bid").val(p_id);
                        }
                        $("#objectId").val(objectId);
                        loadBassModel(p_id);
                        loadTabDetail(p_id);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        } else {
            objectId = p_id;
            $("#objectId").val(objectId);
            loadBassModel(p_id);
            loadTabDetail(p_id);
        }

        function loadBassModel(p_id) {
            var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/purchaseApproval' });
            var baseModel;

            if (p_id == null) {
                baseModel = new BaseModel();
            } else {
                baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            }
            var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
            if (p_id != null) {
                baseView.doLoad(loadMe);
            }

            function loadMe(model, response, options) {
                if (model.get("approvalProcess").status == 0) {
                    $("#commitBtn").show();
                }
                $("#applyUserName").val(model.get("approvalProcess").applyUserName);
                $("#applyUserId").val(model.get("approvalProcess").applyUserId);
                $("#applyDeptName").val(model.get("approvalProcess").applyDeptName);
                $("#applyDeptId").val(model.get("approvalProcess").applyDeptId);

                $("#purchaseCode").val(model.get("purchaseNeeds").code);
                $("#purchaseNeedsId").val(model.get("purchaseNeeds").id);
                var txt = "<a href=\"javascript:viewPurchase(" + model.get("purchaseNeeds").id + ");\">查看详情</a>";
                $("#toView").html(txt);
                process_id = model.get("approvalProcess").id;

                $("#type").val(model.get("approvalProcess").type);
                if (model.get("approvalProcess").status == 0) {
                    $("#commitBtn").show();
                }
                if (model.get("approvalProcess").status != 0) {
                    $("#clear0").hide();
                    $("#clear1").hide();
                    $("#clear2").hide();
                    $("#clear3").hide();
                    $("#clear4").hide();
                    $("#applyUserName").removeClass("texfind");
                    $("#applyDeptName").removeClass("texfind");
                    $("#approvalNames").removeClass("texfind");
                    $("#managername").removeClass("texfind");
                    $("#presidentname").removeClass("texfind");
                }

                getAffixs();

                if (model.get("is_sign") == 0) {
                    $("#is_sign").val("否");
                    $(".hidetr").hide();
                    $("#myCompanyName").val("");
                    $("#companyName").val("");
                    $("#contractName").val("");
                    $("#money").val("");
                    $("#contractType").val("");
                    $("#otherthing").val("");
                    $("#othertr").hide();
                    $("#content").val("");
                } else if (model.get("is_sign") == 1) {
                    $("#is_sign").val("是");
                    $(".hidetr").show();
                    if (model.get("contractType") == 1) {
                        $("#contractType").val("采购");
                    } else if (model.get("contractType") == 2) {
                        $("#contractType").val("租赁");
                    } else if (model.get("contractType") == 3) {
                        $("#contractType").val("合作");
                    } else if (model.get("contractType") == 4) {
                        $("#contractType").val("服务");
                    } else if (model.get("contractType") == 5) {
                        $("#contractType").val("其他");
                        $("#othertr").show();
                    }
                    getAffixs1();
                } else {
                    $(".is_signtr").hide();
                }
                loadRecord(process_id);
            }
        }

        function viewPurchase(id) {
            var msg = "采购需求申请";
            var url = "purchaseneeds_view.html?id=" + id;
            parent.addTabs("查看" + msg + "-" + id, contextPath + "system/qdzxapproval/approval/" + url + "&_pfrid=" + $.getUrlParam("_frid"));
        }

        var max_uplaod = new Max_SwfUpload();

        function getAffixs() {
            $.ajax({
                type: "POST",
                url: contextPath + "affixs",
                data: { "objectType": 321, objectId: objectId },
                dataType: "json",
                success: function (data) {
                    if (data && data.length > 0) {
                        showAffixs(data);
                    } else {
                        $("#showFiles").html("");
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        }

        function showAffixs(data) {
            var fileHtml = "";
            for (var i = 0; i < data.length; i++) {
                fileHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + data[i].name;
                fileHtml += "<a style=\"margin-left:10px\" href=\"javascript:\" onclick=\"downfile(" + data[i].id + ")\">下载</a>";
            }
            $("#showFiles").html(fileHtml);
        }

        function getAffixs1() {
            $.ajax({
                type: "POST",
                url: contextPath + "affixs",
                data: { "objectType": 322, objectId: objectId },
                dataType: "json",
                success: function (data) {
                    if (data && data.length > 0) {
                        showAffixs1(data);
                    } else {
                        $("#showFiles1").html("");
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        }

        function showAffixs1(data) {
            var fileHtml = "";
            for (var i = 0; i < data.length; i++) {
                fileHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + data[i].name;
                fileHtml += "<a style=\"margin-left:10px\" href=\"javascript:\" onclick=\"downfile(" + data[i].id + ")\">下载</a>";
            }
            $("#showFiles1").html(fileHtml);
        }

        function downfile(affixId) {
            window.location.href = contextPath + 'affix/' + affixId + '/download';
        }

        function removefile(affixId, objectId) {
            $.messager.confirm('提示', '确定要删除吗?', function (r) {
                if (r) {
                    $.ajax({
                        type: 'DELETE',
                        url: contextPath + 'affix/' + affixId,
                        data: {},
                        dataType: "json",
                        success: function (data) {
                            if (objectId == 321) {
                                getAffixs();
                            }
                        },
                        error: function (response) {
                            $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                                $.messager.alert("提示", response.responseText, 'error');
                            });
                        }
                    });
                }
            });
        }
        function onloading() {
            $("<div class=\"datagrid-mask\"></div>").css({ display: "block", width: "100%", height: $(window).height() }).appendTo("body");
            $("<div class=\"datagrid-mask-msg\"></div>").html("正在处理，请稍候。。。").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(window).height() - 45) / 2 });
        }
        function removeload() {
            $(".datagrid-mask").remove();
            $(".datagrid-mask-msg").remove();
        }
        //提交
        function commit() {
            var form = $("#my-form");
            if (checkFormMe(form)) {
                $.messager.confirm('提示', '提交前先确认保存完成?', function (r) {
                    if (r) {
                        $.ajax({
                            type: "POST",
                            url: contextPath + "manager/purchase/checkDetails/" + p_id,
                            data: {},
                            dataType: "json",
                            success: function (data) {
                                if (data.handleMsg.status == "0") {
                                    $.messager.alert("提示", data.handleMsg.message);
                                } else {
                                    onloading();
                                    $.ajax({
                                        type: "POST",
                                        url: contextPath + "manager/approvalprocess/commit/" + process_id + "/" + type,
                                        data: {},
                                        dataType: "json",
                                        success: function (data) {
                                            $.messager.alert('提示', data.handleMsg.message, 'info', function (rt) {
                                                removeload();
                                                if (data.handleMsg.status == 1) {
                                                    //图层解锁
                                                    //$("#myForm").unblock();	
                                                    var subtitle = decodeURI(decodeURI($.getUrlParam("subtitle")));
                                                    window.parent.closeWindow(subtitle, $.getUrlParam("_pfrid"));
                                                } else {
                                                    $("#errorMsg").html(data.message);
                                                    //图层解锁
                                                    //$("#myForm").unblock();
                                                }
                                            });
                                        },
                                        error: function (response) {
                                            $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                                                $.messager.alert("提示", response.responseText, 'error');
                                            });
                                        }
                                    });
                                }
                            },
                            error: function (response) {
                                $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                                    $.messager.alert("提示", response.responseText, 'error');
                                });
                            }

                        });
                    }
                });
            }
        }




        function loadTabDetail(p_id) {

            $('#list_data').datagrid({
                url: contextPath + "manager/purchaseContents?i=" + new Date().getTime(),
                fitColumns: true,
                singleSelect: false,
                rownumbers: true,
                pagination: true,
                nowrap: false,
                sortName: 'id',
                sortOrder: 'desc',
                method: 'POST',
                onRowContextMenu: onRowContextMenu,//右键菜单
                queryParams: { "bid": p_id },
                columns: [[
                    { field: 'id', checkbox: true },
                    { field: 'content', title: '名称、型号、配置', width: 200 },
                    { field: 'counts', title: '数量', width: 150 },
                    { field: 'price', title: '单价', width: 300 },
                    { field: 'remark', title: '备注', width: 300 }
                ]]
            });



            $('#list_data2').datagrid({
                url: contextPath + "manager/purchaseThrees?i=" + new Date().getTime(),
                fitColumns: true,
                singleSelect: false,
                rownumbers: true,
                pagination: true,
                nowrap: false,
                sortName: 'id',
                sortOrder: 'desc',
                method: 'POST',
                onRowContextMenu: onRowContextMenu,//右键菜单
                queryParams: { "bid": p_id },
                columns: [[
                    { field: 'id', checkbox: true },
                    { field: 'supplierName', title: '供应商名称', width: 200 },
                    { field: 'orprice', title: '报价', width: 150 },
                    { field: 'contactWay', title: '联系人、联系方式', width: 300 },
                    { field: 'remark', title: '备注', width: 300 }
                ]]
            });
        }



        //查询
        function query1() {
            searchGo(contextPath + "manager/purchaseContents?i=" + new Date().getTime(), "#search", "#list_data");
        }

        //查询
        function queryThree() {
            searchGo(contextPath + "manager/purchaseThrees?i=" + new Date().getTime(), "#search", "#list_data2");
        }

        ////加载领导审核意见
        function loadRecord(process_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/approvalRecords/listApprovalRecord/" + process_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data) {
                        var rHtml = "";
                        var msg = "审核"
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].userType == 5) {
                                msg = "复核";
                            } else {
                                msg = "审核"
                            }
                            rHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + msg + "人：" + data[i].approvalUser.truename + "";
                            if (data[i].approvalDate == null) {
                                rHtml += "<span style=\"margin-left:15px;\">尚未" + msg + "</span>";
                            } else {
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "时间：" + data[i].approvalDate + "</span>";
                                if (data[i].approvalType == 1) {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：同意</span>";
                                } else {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：不同意</span>";
                                }
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "意见：" + data[i].opinion + "</span>";
                            }
                            rHtml += "</div>";
                        }
                        $("#showRecords").html(rHtml);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }





    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 688px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>